[name].vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div
  3. v-if="!data"
  4. class="w-full h-full flex items-center justify-center show"
  5. >
  6. <ILoader class="w-16 h-16 text-foreground" />
  7. </div>
  8. <div
  9. v-else
  10. class="flex flex-col gap-2 show py-4"
  11. >
  12. <div
  13. v-for="(day, dayIdx) in data"
  14. :key="day.title"
  15. class="flex flex-col gap-4 items-center"
  16. >
  17. <h1
  18. class="text-2xl font-semibold"
  19. v-text="day.title"
  20. />
  21. <div
  22. v-for="(lesson, lessonIdx) in day.lessons"
  23. :key="lessonIdx"
  24. class="w-full px-5 py-1 flex items-center justify-between"
  25. :class="{
  26. 'bg-white bg-opacity-10': lesson.available,
  27. }"
  28. >
  29. <div class="flex items-center gap-3 w-[90px]">
  30. <p
  31. class="text-3xl font-semibold opacity-60"
  32. v-text="lesson.number"
  33. />
  34. <div class="flex flex-col text-sm text-center">
  35. <div v-text="lesson.start" />
  36. <div class="w-full h-[1px] bg-foreground" />
  37. <div v-text="lesson.end" />
  38. </div>
  39. </div>
  40. <div class="text-sm text-center font-semibold w-full sm:w-full">
  41. <p v-text="lesson.title ?? 'Свободно'" />
  42. <p
  43. v-if="lesson.teacher"
  44. class="opacity-50"
  45. v-text="lesson.teacher"
  46. />
  47. </div>
  48. </div>
  49. <div
  50. v-if="dayIdx !== data.length - 1"
  51. class="h-[1px] bg-foreground w-11/12 opacity-30"
  52. />
  53. </div>
  54. </div>
  55. </template>
  56. <script setup lang="ts">
  57. import type { TDays } from '~/types/timetable'
  58. definePageMeta({
  59. name: 'Расписание аудитории',
  60. middleware: ['user-only'],
  61. })
  62. const { $api } = useNuxtApp()
  63. const { params: { name } } = useRoute()
  64. const data = ref<TDays>()
  65. onMounted(async () => {
  66. data.value = await $api.timetable.getClassroom(name.toString())
  67. })
  68. </script>